import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.0
import QtQuick.Window 2.2

Rectangle{
    id: broadcast
    property alias checkState: parBox.checkState
    ColumnLayout  {
        anchors.margins: 20
        anchors.fill: parent
        ButtonGroup {
                 id: btnGroup
                 exclusive: false
                 checkState: parBox.checkState
        }
        CheckBox {
            id: parBox
            checkState: btnGroup.checkState
            text: qsTr("全选")
        }
        GridView {
            id: grid
            Layout.fillHeight: true
            Layout.fillWidth: true

            cellWidth: 300
            cellHeight: 64
            delegate: Rectangle{
                width: grid.cellWidth-16
                height: grid.cellHeight-16
                border.width: 2
                border.color: "green"
                Image {
                    id: avatar
                    source: "qrc:/images/user1.png"
                    width: 48
                    height: 48
                }
                Text {
                    anchors.left: avatar.right
                    text: modelData
                    width: 100

                    font.pixelSize: 20
                    anchors.verticalCenter: parent.verticalCenter
                }
                CheckBox {
                    id: chekBox
                    anchors.right: parent.right
                    anchors.top: parent.top
                    anchors.rightMargin: 10
                    anchors.topMargin: 10
                    height: 20
                    width: 20
                    ButtonGroup.group: btnGroup

                }
            }
            Component.onCompleted: {
                model = Services.getLibRoomNames();

            }

        }

    }
}
